<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>编码生成器管理</title>
	<#include "./comm/meta-base.ftl" />
	<#include "./comm/meta-easyui.ftl" />
	<#include "./comm/meta-comm.ftl" />
	<link href="${basePath}/static/css/privilege.css" rel="stylesheet" />
</head>
<body>
 <div id="datagrid_toolbar">
	 <form id="search_form" class="search-form" role="form"   method="post" >
    	<div class="row">
              <div class="form-group col-sm-4">
                <label class="col-sm-4 fm-label">编码生成器标识</label>
                <div class="col-sm-8 fm-control">
                    <input type="text" class="form-control" name="keycodeId" />
                </div>
              </div>
              
              <div class="form-group col-sm-4">
                <label class="col-sm-4 fm-label">生成器名称</label>
                <div class="col-sm-8 fm-control">
                    <input type="text" class="form-control" name="generatorName"  />
                </div>
              </div>
              <div class="form-buttons col-sm-4" >
              	<a href="javascript:submitForm()" class="btn btn-sm  btn-blue">
                    <i class="btn-label fa  fa-search "></i>查 询</a>
                
                <a href="javascript:resetForm('search_form')" class="btn btn-sm btn-default  margin-left-10 ">
                    <i class="btn-label fa  fa-reply "></i>重 置</a>
            </div>
         </div>
    </form>
    
    <div class="buttons-preview" >
        <a class="btn btn-default  btn-sm" 
        	href="javascript:addElement()"><i class="fa fa-plus"></i>新增</a>
        <a class="btn btn-primary btn-sm" 
        	href="javascript:modifyElement()"><i class="fa fa-edit"></i>修改</a>
        <a class="btn btn-danger btn-sm" 
        	href="javascript:removeElement()"><i class="fa fa-times"></i>删除</a>
        <a class="btn  btn-sm" 
        	href="javascript:keycodeTool()"><i class="fa fa-desktop"></i>编码生成器工具</a>
    </div>
</div>

<table id="data_table" class="easyui-datagrid"  border="0"  pagination="true" pageSize='20'  rownumbers="true" fitColumns="true" fit="true"
       data-options="
       url: '${basePath}/keycode/keycode-list-json',
       method: 'get',
       rownumbers: true,
       idField: 'id',
       singleSelect: true,
       toolbar:'#datagrid_toolbar'
        ">
   <thead>
   <tr>
        <th data-options="field:'keycodeId',width:width(0.1)">生成器标识</th>
        <th data-options="field:'generatorName',width:width(0.1)">生成器名称</th>
        <th data-options="field:'expression',width:width(0.3)">表达式</th>
        <th data-options="field:'keycodeCurrentValue',width:width(0.2)">编码当前值</th>
        <th data-options="field:'dateFormat',width:width(0.1)">日期格式</th>
        <th data-options="field:'dateValue',width:width(0.1)">日期值</th>
        <th data-options="field:'sequenceStart',width:width(0.1)">序列起始值</th>
        <th data-options="field:'sequenceLength',width:width(0.1)">序列长度</th>
        <th data-options="field:'sequenceDigits',width:width(0.1)">序列进制</th>
        <th data-options="field:'isSequenceDateIncrement',width:width(0.1)">序列是否日期自增</th>
        <th data-options="field:'sequenceDigitsValue',width:width(0.1)">序列进制值</th>
        <th data-options="field:'sequenceCurrentValue',width:width(0.1)">序列当前值</th>
    </tr>
   </thead>
</table>


</body>
</html>
<script type="text/javascript">

function submitForm(){
	$("#search_form").form('submit', {
		url : '${basePath}/keycode/keycode-list-json',
		success : function(data) {
			var obj = jQuery.parseJSON(data);  
			$("#data_table").datagrid('loadData',obj);
		}
	});
}

function addElement(){
	url="${basePath}/keycode/keycode-addin";
	winName="新增编码生成器";
	MainTab.createTab("KEYCODEADD",winName,url);
}
function modifyElement(){
	var row = $('#data_table').datagrid('getSelected');
	if(null!=row){
		url="${basePath}/keycode/keycode-modifyin/"+row.keycodeId;
		winName="编辑编码生成器";
		MainTab.createTab("KEYCODEMODIFY",winName,url);
	}else{
		Notify('请选择要操作的编码', 'top-right', '5000', 'danger', 'fa-bolt', true);
	}
}
function removeElement(){
	var row = $('#data_table').datagrid('getSelected');
	if(null!=row){
		var url="${basePath}/keycode/keycode-remove/"+row.keycodeId;
		bootbox.confirm("你确定要删除"+row.generatorName+"?", function (result) {
        	if (result) {
            	$.post(url,{},function(data){
					$("#data_table").datagrid("reload");
				});
         	}
        });
		
	}else{
		Notify('请选择要操作的编码', 'top-right', '5000', 'danger', 'fa-bolt', true);
	}
}

function keycodeTool(){
	var row = $('#data_table').datagrid('getSelected');
	var url="${basePath}/keycode/keycode-intool";
	if(null!=row){
		url="${basePath}/keycode/keycode-intool?keycodeId="+row.keycodeId;
	}
	
	openWindow("编码生成器工具",url,800,500,true);
	
}



$(document).ready(function(){
	
});
</script>


